﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace Moving03.Services
{
    /// <summary>
    /// Summary description for WSNoiDen
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]

    
    public class WSNoiDen : System.Web.Services.WebService
    {
        DataClasses1DataContext context = new DataClasses1DataContext();
        [WebMethod]
        public classThongTinNoiDen noiDen(int idMaNoiDen)
        {
            classThongTinNoiDen noiden = new classThongTinNoiDen();
            NoiDen nd = context.NoiDens.Single(p => p.Id_NoiDen == idMaNoiDen);
            DanhSachQuocGia qg = context.DanhSachQuocGias.Single(p => p.Id_MaQGia == nd.Id_Quocgia);
            noiden.QuocGia = qg.TenQuocGia;
            noiden.ThanhPho = nd.Thanhpho;
            noiden.NguoiNhan = nd.Nguoinhan;
            noiden.NhaRieng = (int)nd.Nharieng;
            noiden.DiaChi1 = nd.Diachi1;
            noiden.DiaChi2 = nd.Diachi2;
            noiden.DienThoai = nd.Dienthoai;           
            return noiden;
        }
    }
}
